package com.liuzu.esys.controller;

import com.liuzu.esys.common.LayuiPageVo;
import com.liuzu.esys.common.R;
import com.liuzu.esys.pojo.FinMember;
import com.liuzu.esys.service.FinMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author : 松松
 * @date : 2022/7/26
 * @desc : 会员财务功能实现
 */

@RestController
@RequestMapping("/finmember")
public class FinMemberController {

    @Autowired
    private FinMemberService finMemberService;


    //查询会员财务列表
    @RequestMapping("/fmlist")
    public LayuiPageVo<FinMember> finMemberLayuiPageVo(@RequestParam Map<String,Object> params){
        return finMemberService.fmList(params);
    }


    //添加会员财务信息
    @RequestMapping("/fmadd")
    public R fmadd(FinMember finMember){
        int flag = finMemberService.addfm(finMember);
        if (flag == 1){
            return R.ok();
        }else {
            return R.error();
        }
    }


    //删除会员财务信息
    @RequestMapping("/fmdel")
    public R fmdel(Integer id){
        int flag = finMemberService.delfm(id);
        if (flag == 1){
            return R.ok();
        }else {
            return R.error();
        }
    }


    //修改会员财务信息
    @RequestMapping("/fmset")
    public R fmset(FinMember finMember){
        int flag = finMemberService.setfm(finMember);
        if (flag == 1){
            return R.ok();
        }else {
            return R.error();
        }
    }

}
